package edu.ped.android.utils;

import java.io.Serializable;
import java.util.ArrayList;

public abstract class GestureNFC implements Serializable {

	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;

	public static final int COMPARE_SUCCESS = 1;
	public static final int COMPARE_TOO_LONG_JUMP = -2;
	public static final int COMPARE_FAIL = -1;

	protected ArrayList<MyPoint> trajectory;
	protected static final int DELTA = 0;
	protected static final int SAUT = 1;
	
	protected GestureNFC(){
		trajectory = new ArrayList<MyPoint>();		
	}

	public ArrayList<MyPoint> getTrajectory(){
		return this.trajectory;
	}
	
	public void addPosition(int x, int y){
		trajectory.add(new MyPoint(x,y));
	}
	/** @param reference Trajectoire de reference*/
	public abstract int compare(GestureNFC reference);
	
	public String toString(){
		String s= new String();
		s+="[ ";
		for(MyPoint p : trajectory) 
			s+=p.toString() +",";
		s+=" ]";
		return s;
	}



	public void setTrajectory(ArrayList<MyPoint> trajectory) {
		this.trajectory = trajectory;
	}

	public int contains(int x, int y) {
		for(int i = 0; i<trajectory.size();i++){
			if(trajectory.get(i).getX()==x && trajectory.get(i).getY()==y)
				return i;
		}
		return -1;
	}
	
}
